package o;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.viewpager.widget.ViewPager;
import huawei.support.v4.widget.HwDotsPageIndicator;
import java.util.ArrayList;
import java.util.List;
import o.beo.f;

public class bhn extends fai implements OnClickListener {
    private View ˊ;
    private Context ˋ;
    private boolean ˏ;

    public bhn(Context context, boolean z) {
        this.ˋ = context;
        this.ˏ = z;
    }

    public View ˏ() {
        if (this.ˋ != null) {
            this.ˊ = LayoutInflater.from(this.ˋ).inflate(beo$j.ʾ, null);
            ((TextView) this.ˊ.findViewById(beo$e.ˑॱ)).setText(f.ʿ);
            this.ˊ.findViewById(beo$e.ʻ).setOnClickListener(this);
            ॱॱ();
            return this.ˊ;
        } else if (!Logger.ˎ()) {
            return null;
        } else {
            Logger.ˏ("GameModeHelpWindow", "onCreateView, context == null");
            return null;
        }
    }

    private List<bhx> ॱ() {
        List ˎ;
        if (this.ˏ) {
            Logger.ˏ("GameModeHelpWindow", "is offline mode");
            fae ˏ = fam.ॱ().ˏ();
            if (ˏ == null) {
                Logger.ˏ("GameModeHelpWindow", "buoyBridge == null");
                return null;
            }
            ˎ = bii.ˎ(ˏ.getGameInfo());
        } else {
            ˎ = big.ˎ();
        }
        if (CollectCheck.isEmpty(r0)) {
            Logger.e("GameModeHelpWindow", "gameModeList is null or empty");
            return null;
        }
        List<bhx> arrayList = new ArrayList();
        for (String str : r0) {
            if ("game_power_save_mode".equals(str)) {
                Object o_bia;
                if (azc.ˎ().ॱ() <= 14) {
                    o_bia = new bia(this.ˋ, this);
                } else {
                    o_bia = new bhv(this.ˋ, this);
                }
                arrayList.add(o_bia);
            } else if ("game_dnd_mode".equals(str)) {
                if (!bii.ॱ() || big.ˊ()) {
                    arrayList.add(new bhw(this.ˋ, this));
                } else {
                    arrayList.add(new bhu(this.ˋ, this));
                }
            } else if ("game_key_control_mode".equals(str)) {
                arrayList.add(new bic(this.ˋ, this));
            } else {
                if ("calling_dnd".equals(str)) {
                    arrayList.add(new bhy(this.ˋ, this));
                }
                ˎ(arrayList, str);
            }
        }
        return arrayList;
    }

    private void ˎ(List<bhx> list, String str) {
        if ("keep_luminance".equals(str)) {
            list.add(new bhz(this.ˋ, this));
        }
    }

    public View ˊ(@IdRes int i) {
        if (this.ˊ == null) {
            return null;
        }
        return this.ˊ.findViewById(i);
    }

    private void ॱॱ() {
        List ॱ = ॱ();
        if (!CollectCheck.isEmpty(ॱ)) {
            ViewPager viewPager = (ViewPager) ˊ(beo$e.ᐝᐝ);
            if (viewPager == null) {
                Logger.ˋ("GameModeHelpWindow", "mViewPager null");
                return;
            }
            viewPager.setAdapter(new bhf(ᐝ(), ॱ));
            HwDotsPageIndicator hwDotsPageIndicator = (HwDotsPageIndicator) ˊ(beo$e.ˑ);
            if (hwDotsPageIndicator == null) {
                Logger.ˋ("GameModeHelpWindow", "indicator null");
            } else {
                hwDotsPageIndicator.setViewPager(viewPager);
            }
        } else if (Logger.ˎ()) {
            Logger.ˏ("GameModeHelpWindow", "segment list is empty");
        }
    }

    public void onClick(View view) {
        if (view.getId() == beo$e.ʻ) {
            ॱ(this.ˋ);
        }
    }
}
